package cn.gzjp;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

import springfox.documentation.service.Contact;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import static springfox.documentation.builders.PathSelectors.regex;
import static com.google.common.base.Predicates.or;

@Configuration
@EnableSwagger2
@EnableWebMvc
@ComponentScan("cn.gzjp.modules.rice.api.web")
/**
 * 测试111
 */
public class SwaggerConfig {
	
	
    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
        		.select()  // 选择那些路径和api会生成document
                .apis(RequestHandlerSelectors.any()) // 对所有api进行监控
                //.paths(PathSelectors.any()) // 对所有路径进行监控
                .paths(or(regex("/api/rice/.*")))//过滤的接口
                .build();
    }
    private ApiInfo apiInfo() {
    	Contact contact = new Contact("zengcp","","83004003@qq.com");
    	ApiInfo apiInfo = new 
        		ApiInfo("智慧物流管理平台API接口","提供给小程序调用的Restful接口","1.0","https://car.starsns.cn",contact,"",null);
        return apiInfo;
    }


}